package com.example.j2025_11_17.Mapper;

import com.example.j2025_11_17.Model.UserInfo;
import org.apache.ibatis.annotations.*;

import java.util.LinkedList;
import java.util.List;

@Mapper
public interface UserMapper {
    @Select("select * from user_info")
    List<UserInfo> selectAll();

    @Select("select * from user_info where id = 2")
    UserInfo selectAll2();
    @Select("select * from user_info where id = '${id}'")
    UserInfo selectAll3(Integer id);

    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("INSERT INTO user_info (username,`password`,age) VALUES(#{username},#{password},#{age})")
    Integer insertValues(UserInfo userInfo);

    @Delete("DELETE FROM user_info WHERE id = #{id}")
    void deleteValues(Integer id);

    @Update("UPDATE user_info set username = #{username} WHERE id = #{id}")
    void updateValues(UserInfo userInfo);



    @Select("select * from user_info where username = #{username} and password = '${password}'")
    List<UserInfo> selectlogin(String username,String password);

}
